[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable={{ elk_path.apps }}/minio/minio

[Service]
WorkingDirectory={{ elk_path.apps }}/minio

User={{ elk_user }}
Group={{ elk_group }}
ProtectProc=invisible

EnvironmentFile=-{{ elk_path.apps }}/minio/minio.conf
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in {{ elk_path.apps }}/minio/minio.conf\"; exit 1; fi"
ExecStart={{ elk_path.apps }}/minio/minio server $MINIO_OPTS $MINIO_VOLUMES

# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# This may improve systemctl setups where other services use `After=minio.server`
# Uncomment the line to enable the functionality
# Type=notify

# Let systemd restart this service always
Restart=always
RestartSec=5
StartLimitIntervalSec=60
StartLimitBurst=3

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of threads this process can create
TasksMax=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target
